package com.zdsoft.crm.service.auth.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zdsoft.crm.dao.auth.ISysRoleFuncMapper;
import com.zdsoft.crm.entity.auth.SysRoleFunc;
import com.zdsoft.crm.service.auth.ISysRoleFunctionService;
import com.zdsoft.crm.util.UUIDUtil;

@Service
@Transactional
public class SysRoleFunctionServiceImpl implements ISysRoleFunctionService{

	@Autowired
	ISysRoleFuncMapper iSysRoleFuncMapper;
	

	
	@Override
	public void save(String roleId,String[] funcIds) {
		iSysRoleFuncMapper.deleteByRoleId(roleId);
		for (String funcId : funcIds) {
			SysRoleFunc roleFuncb=new SysRoleFunc();
			roleFuncb.setId(UUIDUtil.uuid());
			roleFuncb.setFunc_id(funcId);
			roleFuncb.setRole_id(roleId);
			iSysRoleFuncMapper.save(roleFuncb);
		}
		
	}



}
